﻿using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace ModelLayer
{
    [DataContract]
    public abstract class Person
    {
        [DataMember]
        public string FName { get; set; }
        [DataMember]
        public string LName { get; set; }
        [DataMember]
        public string Address { get; set; }
        [DataMember]
        public int ZipCode { get; set; }
        [DataMember]
        public int PhoneNo { get; set; }
        [DataMember]
        public string Country { get; set; }
        [DataMember]
        public string PassportNo { get; set; }
        //Overrides equals to compare persons on their phone number
        public override bool Equals(object _obj)
        {
            bool equal = false;
            Person objPerson = (Person) _obj;
            if (PhoneNo.Equals(objPerson.PhoneNo))
            {
                equal = true;
            }
            return equal;
        }
        //Overrides the string representation of the object
        public override string ToString()
        {
            return string.Format("Fname: {0} \n Lname: {1} \n adress: {2} \n Zipcode: {3} \n Phone number: {4}", FName,
                LName, Address, ZipCode, PhoneNo);
        }
    }
}